package org.hxyjs.dao.impl;

import org.hxyjs.dao.MutualattentionDao;
import org.hxyjs.entity.Mutualattention;
import org.hxyjs.mapper.MutualattentionMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("mutualattentionDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class MutualattentionDaoImpl implements MutualattentionDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private MutualattentionMapper mutualattentionMapper;
    public List<Mutualattention>  getAllMutualattentions() throws Exception{
        return mutualattentionMapper.selectByExample(null);
    }

    @Override
    public Integer deleteMutualattentionByMano(String mano)  throws Exception{
        return mutualattentionMapper.deleteByPrimaryKey(mano);
    }

    @Override
    public Integer updateMutualattentionByMano(Mutualattention mutualattention)  throws Exception{
        return mutualattentionMapper.updateByPrimaryKey(mutualattention);
    }

    @Override
    public Integer addMutualattention(Mutualattention mutualattention)  throws Exception{
        return mutualattentionMapper.insertSelective(mutualattention);
    }

}
